package com.scienceplus.dgraph_import;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: hujian
 * @Date: 2020/9/25 18:01
 * @Description: 序列化后的Paper对象
 */
public class PaperSerialized {
    private String uid;
    private List<String> entities;
    private String magId;
    private String journalVolume;
    private String journalPages;
    private String pmid;
    private List<String> fieldsOfStudy;
    private int year;
    private List<Outcitation> outcitationis;
    private String s2Url;
    private String s2PdfUrl;
    private String id;
    private List<Author> authoris;
    private String journalName;
    private String paperAbstract;
    private List<Incitation> incitationis;
    private List<String> pdfUrls;
    private String title;
    private String doi;
    private List<String> sources;
    private String doiUrl;
    private String venue;

    // 从paper构造一个新的序列化paper对象
    public PaperSerialized(Paper paper) {
        this.uid = "_:" + paper.getId();
        this.entities = paper.getEntities();
        this.magId = paper.getMagId();
        this.journalVolume = paper.getJournalVolume();
        this.journalPages = paper.getJournalPages();
        this.pmid = paper.getPmid();
        this.fieldsOfStudy = paper.getFieldsOfStudy();
        this.year = paper.getYear();
        List<String> out_ids = paper.getOutCitations();
        List<Outcitation> outcitations = new ArrayList<>();
        if (null != out_ids) {
            for (String out_id : out_ids) {
                Outcitation outcitation = new Outcitation(out_id);
                outcitations.add(outcitation);
            }
        }
        this.outcitationis = outcitations;
        this.s2Url = paper.getS2Url();
        this.s2PdfUrl = paper.getS2PdfUrl();
        this.id = paper.getId();
        List<Author> authors = paper.getAuthors();
        List<Author> serializedAuthors = new ArrayList<>();
        if (null != authors) {
            for (Author author : authors) {
                Author author1 = new Author(author.getName(), author.getIds());
                serializedAuthors.add(author1);
            }
        }
        this.authoris = serializedAuthors;
        this.journalName = paper.getJournalName();
        this.paperAbstract = paper.getPaperAbstract();
        List<String> in_ids = paper.getOutCitations();
        List<Incitation> incitations = new ArrayList<>();
        if (null != in_ids) {
            for (String in_id : in_ids) {
                Incitation incitation = new Incitation(in_id);
                incitations.add(incitation);
            }
        }
        this.incitationis = incitations;
        this.pdfUrls = paper.getPdfUrls();
        this.title = paper.getTitle();
        this.doi = paper.getDoi();
        this.sources = paper.getSources();
        this.doiUrl = paper.getDoiUrl();
        this.venue = paper.getVenue();
    }

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public void setEntities(List<String> entities) {
        this.entities = entities;
    }

    public List<String> getEntities() {
        return entities;
    }

    public void setMagId(String magId) {
        this.magId = magId;
    }

    public String getMagId() {
        return magId;
    }

    public void setJournalVolume(String journalVolume) {
        this.journalVolume = journalVolume;
    }

    public String getJournalVolume() {
        return journalVolume;
    }

    public void setJournalPages(String journalPages) {
        this.journalPages = journalPages;
    }

    public String getJournalPages() {
        return journalPages;
    }

    public void setPmid(String pmid) {
        this.pmid = pmid;
    }

    public String getPmid() {
        return pmid;
    }

    public void setFieldsOfStudy(List<String> fieldsOfStudy) {
        this.fieldsOfStudy = fieldsOfStudy;
    }

    public List<String> getFieldsOfStudy() {
        return fieldsOfStudy;
    }

    public void setYear(int year) {
        this.year = year;
    }

    public int getYear() {
        return year;
    }

    public List<Outcitation> getOutcitationis() {
        return outcitationis;
    }

    public void setOutcitationis(List<Outcitation> outcitationis) {
        this.outcitationis = outcitationis;
    }

    public void setS2Url(String s2Url) {
        this.s2Url = s2Url;
    }

    public String getS2Url() {
        return s2Url;
    }

    public void setS2PdfUrl(String s2PdfUrl) {
        this.s2PdfUrl = s2PdfUrl;
    }

    public String getS2PdfUrl() {
        return s2PdfUrl;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getId() {
        return id;
    }

    public void setAuthoris(List<Author> authoris) {
        this.authoris = authoris;
    }

    public List<Author> getAuthoris() {
        return authoris;
    }

    public void setJournalName(String journalName) {
        this.journalName = journalName;
    }

    public String getJournalName() {
        return journalName;
    }

    public void setPaperAbstract(String paperAbstract) {
        this.paperAbstract = paperAbstract;
    }

    public String getPaperAbstract() {
        return paperAbstract;
    }

    public List<Incitation> getIncitationis() {
        return incitationis;
    }

    public void setIncitationis(List<Incitation> incitationis) {
        this.incitationis = incitationis;
    }

    public void setPdfUrls(List<String> pdfUrls) {
        this.pdfUrls = pdfUrls;
    }

    public List<String> getPdfUrls() {
        return pdfUrls;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getTitle() {
        return title;
    }

    public void setDoi(String doi) {
        this.doi = doi;
    }

    public String getDoi() {
        return doi;
    }

    public void setSources(List<String> sources) {
        this.sources = sources;
    }

    public List<String> getSources() {
        return sources;
    }

    public void setDoiUrl(String doiUrl) {
        this.doiUrl = doiUrl;
    }

    public String getDoiUrl() {
        return doiUrl;
    }

    public void setVenue(String venue) {
        this.venue = venue;
    }

    public String getVenue() {
        return venue;
    }
}
